Passed
Pull Request — master (#2)
by
unknown
03:05
created

router.js ➔ ???   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1.008

Importance

Changes 3
Bugs 0 Features 2
Metric Value
cc 1
nc 1
nop 4
dl 0
loc 23
ccs 8
cts 10
cp 0.8
crap 1.008
rs 9.328
c 3
b 0
f 2

1 Function

Rating   Name   Duplication   Size   Complexity  
B router.js ➔ ... ➔ ??? 0 21 5
1
/**
2
 * @method setup
3
 * @param  {Function}   setTitle    setTitle callback
4
 * @param  {Object}     options     { router: RouterInstance }
0 ignored issues
show
Documentation introduced by
The parameter options does not exist. Did you maybe forget to remove this comment?
Loading history...
5
 * @return {void}
6
 */
7 2
const setup = (setTitle, setPrefix, setSuffix, { router }) => {
8 1
  router.afterEach((to, from) => {
0 ignored issues
show
Unused Code introduced by
The parameter from is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
9 2
    const { meta } = to
10
11
    // if has meta
12 2
    if (meta) {
13
      // if has title
14 2
      if (meta.title) {
15 1
        setTitle(meta.title)
16
      }
17
18
      // if has titlePrefix
19 2
      if (meta.titlePrefix) {
20
        setPrefix(meta.titlePrefix)
21
      }
22
23
      // if has titleSuffix
24 2
      if (meta.titleSuffix) {
25
        setSuffix(meta.titleSuffix)
26
      }
27
    }
28
  })
29
}
30
31
export { setup }
32